<?php

	require_once('../config.php');
	include_once("../database/DataBase.php");
	include_once("../include/function.php");
				
	session_start();
	checkLogin();
	
	
	$database = New DataBase();
	$database->open_connection();
	$result = $database->getUserType($_SESSION["user_type"]);
	
?>
<!DOCTYPE html>
<html>
	<head>
	<title>CMS</title>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<?
			include_once("../include/includeHeader.php");
		?>

		<script>
		$(function() {
			$( "#birthday" ).datepicker({
				dateFormat: 'dd/mm',
				changeMonth: true,
				changeYear: true
			});
		});
		</script>		
	</head>
	
	<body>
			<?php
				include_once("../include/top_navigation.php");
			?>
			<div Class="Middle">
				<div class="LeftMenu">
					<?php include_once("../include/left_menu.php"); ?>
				</div>
				<div id="RightContent" >
					<h2>New User</h2>
					
					<form name="newUser" method="POST">
						
						<table class="userForm">
							<tr>
								<td colspan="2"><div name="message" id="message" ></div></td>
							</tr>
							<tr>
								<td>Login name : </td>
								<td><input type="text" name="login_id" id="login_id" value="" onblur="javascript: checkLoginName(this);"></td>
							</tr>
							<tr>
								<td>Password : </td>
								<td><input type="password" name="pwd" id="pwd" value=""></td>
							</tr>
							<tr>
								<td>Confirm Password : </td>
								<td><input type="password" name="con_pwd" id="con_pwd" value=""></td>
							</tr>
							<tr>
								<td>Email : </td>
								<td><input type="text" name="email" id="email" value=""></td>
							</tr>
							
							<tr>
								<td>First name : </td>
								<td><input type="text" name="firstname" id="firstname" value=""></td>
							</tr>
							<tr>
								<td>Last name : </td>
								<td><input type="text" name="lastname" id="lastname" value=""></td>
							</tr>
							<tr>
								<td>Contact No : </td>
								<td><input type="text" name="contact_no" id="contact_no" value=""></td>
							</tr>
							<tr>
								<td>User Type : </td>
								<td>
									<select name="type" id="type" >
										<option value=""> -- </option>
										<?php
											while ($row = mysql_fetch_assoc($result)) {
												echo "<option value=\"".$row["type"]."\">".$row["description"]."</option>";
											}
										?>
									</select>
								</td>
							</tr>
							<tr>
								<td>Address : </td>
								<td><input type="text" name="address" id="address" value=""></td>
							</tr>
							<tr>
								<td>Birthday : </td>
								<td><input type="text" name="birthday" value="" placeholder="DD/MM/YYY" id="birthday"></td>
							</tr>
							<tr>
								<td>Note : </td>
								<td><textarea name="note" id="note" rows="4" cols="50"><? echo $user["note"];?></textarea></td>
							</tr>
							<tr>
								<td colspan="2"><input type="button" name="click_button" value="Submit" onclick="javascript: checkRegForm(document.newUser);" /></td>
							</tr>
						</table>
					</form>
				</div>
			</div>
			<?php
				include_once("../include/footer.php");
			?>
		
	</body>
</html>
<?
	$database->close_connection();
?>